﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    x:Class="Flare.Style"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:conv="clr-namespace:Flare.Converter"
                    xmlns:Controls="clr-namespace:Flare.Controls">

    <!-- Новая политра-->
    <SolidColorBrush x:Key="ColorTextBackground" Color="#FF919191" />
    <SolidColorBrush x:Key="ColorText" Color="#FF737679" />
    <SolidColorBrush x:Key="ColorInputText" Color="#FF363C41" />

    <SolidColorBrush x:Key="ColorTextIsSelected" Color="#FF00ABDC" />

    <SolidColorBrush x:Key="ColorActiveElement" Color="#FF1FCAFF" />
    <SolidColorBrush x:Key="ColorBorder" Color="#FFC7C7C7" />

    <SolidColorBrush x:Key="ColorGreyPastel" Color="#FFD4D4D4"/>
    <SolidColorBrush x:Key="ColorBluePastel" Color="#FFBFE6E8"/>
    <SolidColorBrush x:Key="ColorGreenPastel" Color="#FFBDDBC0"/>
    <SolidColorBrush x:Key="ColorRedPastel" Color="#FFF5D5A7"/>
    <!--<Controls:FlameMenu />-->

    <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

    <Style x:Key="SelectedBorder" TargetType="{x:Type Border}">
        <Style.Setters>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="SnapsToDevicePixels" Value="True" />
        </Style.Setters>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource ColorActiveElement}" />
                <Setter Property="Background" Value="White" />
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
        <Setter Property="FontSize" Value="22" />
        <Setter Property="FontFamily" Value="Segoe UI" />
        <Setter Property="Foreground" Value="{DynamicResource ColorInputText}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ColorBorder}" />
        <Setter Property="Background" Value="White" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" 
                            Background="{TemplateBinding Background}"
                            BorderThickness="1">
                        <ScrollViewer x:Name="PART_ContentHost" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch"
                                          VerticalContentAlignment="Center" HorizontalContentAlignment="Left" IsEnabled="{TemplateBinding IsEnabled}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ColorActiveElement}" />
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border BorderThickness="1" Background="Transparent">
                        <Border.Style>
                            <Style TargetType="Border">
                                <Setter Property="BorderBrush" Value="{DynamicResource ColorBorder}" />
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="BorderBrush" Value="{DynamicResource ColorActiveElement}" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Border.Style>
                        <TextBlock x:Name="PART_ContentHost" Text="{TemplateBinding Content}" Foreground="{DynamicResource ColorText}" FontSize="22" 
                               FontFamily="Segoe UI" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="4"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type CheckBox}" TargetType="{x:Type CheckBox}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <Border Style="{DynamicResource SelectedBorder}">
                        <DockPanel LastChildFill="False" Margin="2">
                            <TextBlock Text="{TemplateBinding Content}" Foreground="{StaticResource ColorTextBackground}" VerticalAlignment="Center" 
                                       HorizontalAlignment="Left" DockPanel.Dock="Left" FontSize="18" FontFamily="Segoe UI Light" />
                            <Border BorderBrush="{StaticResource ColorBorder}" BorderThickness="2" Height="20" Width="20" VerticalAlignment="Center" 
                                    Background="Transparent" DockPanel.Dock="Right" Margin="8,0,0,0">
                                <Path x:Name="PART_CheckBox"  Data="M0,5 L4,12 L12,0" Stroke="{DynamicResource ColorText}" StrokeThickness="2" 
                                      VerticalAlignment="Center" HorizontalAlignment="Center" StrokeStartLineCap="Round" StrokeEndLineCap="Round"
                                      Visibility="{TemplateBinding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                            </Border>
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleHelpMessage" TargetType="{x:Type Label}">
        <Setter Property="FontSize" Value="16"/>
        <Setter Property="Foreground" Value="{DynamicResource ColorTextBackground}" />
        <Style.Triggers>
            <EventTrigger RoutedEvent="Label.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <ThicknessAnimation Storyboard.TargetProperty="Margin" From="0,0,0,0" To="10,0,0,0" RepeatBehavior="6" Duration="3" />
                        <DoubleAnimation Storyboard.TargetProperty="Opacity" From=".1" To=".0" Duration="0" BeginTime="0:0:8" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="StyleMenuRepeater" TargetType="{x:Type ListBox}">
        <Setter Property="ItemContainerStyle" Value="{DynamicResource StyleMenuRepeaterItem}" />
        <Setter Property="ListBox.ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ListBox.Template">
            <Setter.Value>
                <ControlTemplate>
                    <ItemsPresenter />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="StyleMenuRepeaterItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Margin" Value="12,0,12,0" />
        <Setter Property="IsSelected" Value="True" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{DynamicResource ColorTextBackground}" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <TextBlock Text="{Binding Caption}" Foreground="{TemplateBinding Foreground}" FontSize="26" 
                               FontFamily="Segoe UI Light" VerticalAlignment="Center" HorizontalAlignment="Center" TextDecorations="Underline"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource ColorTextIsSelected}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource ColorActiveElement}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <Style x:Key="StylePhoneList" TargetType="{x:Type ListBox}">
        <Setter Property="ItemContainerStyle" Value="{DynamicResource StylePhoneListItem}" />
        <Setter Property="ListBox.ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ListBox.Template">
            <Setter.Value>
                <ControlTemplate>
                    <ItemsPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="StylePhoneListItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                        <TextBlock Text="{Binding description}" VerticalAlignment="Center" FontSize="16" FontFamily="Segoe UI" Foreground="{DynamicResource ColorText}"/>
                        <TextBlock Margin="10,0,0,0" Text="{Binding providerphone}" VerticalAlignment="Top" FontSize="20" Foreground="{StaticResource ColorText}" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleBorderZoomed" TargetType="{x:Type Border}">
        <Setter Property="Margin" Value="5" />
        <Setter Property="Border.RenderTransformOrigin">
            <Setter.Value>
                <Point X=".5" Y=".5"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Border.RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <EventTrigger RoutedEvent="Button.MouseEnter">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" 
                                                        From="1" To="1.03" Duration="0:0:0.1" />
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" 
                                                        From="1" To="1.03" Duration="0:0:0.1" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
            <EventTrigger RoutedEvent="Button.MouseLeave">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" 
                                                        From="1.03" To="1" Duration="0:0:0.1" />
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" 
                                                        From="1.03" To="1" Duration="0:0:0.1" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

        </Style.Triggers>
    </Style>


    <Style x:Key="StyleListBox" TargetType="{x:Type ListBox}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling"/>
        <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel ItemWidth="300" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleListBoxVertical" TargetType="{x:Type ListBox}" BasedOn="{StaticResource StyleListBox}">
        <Setter Property="SelectionMode" Value="Single"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling"/>
        <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleListBoxHorizontal" TargetType="{x:Type ListBox}" BasedOn="{StaticResource StyleListBox}">
        <Setter Property="ListBox.ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ListBox.Template">
            <Setter.Value>
                <ControlTemplate>
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" CanContentScroll="False">
                        <ItemsPresenter />
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleUpdateFileItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="UseLayoutRounding" Value="False" />
        <Setter Property="Margin" Value="0,4" />
        <Setter Property="Cursor" Value="ScrollE" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border Background="{DynamicResource ColorGreyPastel}" >
                        <TextBlock Text="{Binding Key}" FontSize="16" Foreground="{DynamicResource DefaultTextColor}" FontFamily="Segoe UI" Margin="10" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleUpdateFilialItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="UseLayoutRounding" Value="False" />
        <Setter Property="Margin" Value="4" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Controls:TilesUpdateList Header="{Binding Value.name}" UpdateItems="{Binding Value.updatelist}" Area="{Binding Key}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleUpdateCaption" TargetType="{x:Type Label}">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="UseLayoutRounding" Value="False" />
        <Setter Property="Margin" Value="0,4" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Background" Value="{DynamicResource ColorGreenPastel}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Border Background="{TemplateBinding Background}" >
                        <TextBlock Text="{TemplateBinding Content}" FontSize="16" Foreground="{DynamicResource ColorText}" FontFamily="Segoe UI" Margin="10" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="StyleUrl" TargetType="{x:Type Label}">
        <Setter Property="FontSize" Value="18" />
        <Setter Property="Margin" Value="0,2" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Border Style="{DynamicResource SelectedBorder}" UseLayoutRounding="True">
                        <ContentPresenter TextElement.FontFamily="Segoe UI" TextElement.FontSize="{TemplateBinding FontSize}" 
                                   TextElement.FontStyle="Normal" TextElement.Foreground="{DynamicResource ColorInputText}" TextElement.FontWeight="Normal" Margin="4,2">
                            <ContentPresenter.Resources>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="TextDecorations" Value="Underline" />
                                </Style>
                            </ContentPresenter.Resources>
                        </ContentPresenter>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="NetworkConnectHistory" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Margin" Value="4,8,4,14" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <DockPanel Grid.Row="0" VerticalAlignment="Bottom">
                            <TextBlock HorizontalAlignment="Center" Margin="0,0,0,2" Foreground="{DynamicResource ColorText}" DockPanel.Dock="Top">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Text" Value="{Binding check_delay, Mode=OneWay, StringFormat='{}{0}мс'}" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding check_delay}" Value="{x:Null}">
                                                <Setter Property="Text" Value="Недоступен" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>

                            <Border DockPanel.Dock="Top">
                                <Border.Style>
                                    <Style TargetType="Border">
                                        <Setter Property="VerticalAlignment" Value="Bottom" />
                                        <Setter Property="Background" Value="{DynamicResource ColorGreenPastel}" />
                                        <Setter Property="Height" Value="{Binding check_graph_h}" />
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding check_delay}" Value="{x:Null}">
                                                <Setter Property="Background" Value="{StaticResource ColorRedPastel}"  />
                                                <Setter Property="Height" Value="5"  />
                                                <Setter Property="VerticalAlignment" Value="Bottom" />
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Border.Style>
                            </Border>

                        </DockPanel>

                        <TextBlock Text="{Binding check_time, Mode=OneWay, StringFormat={}{0:dd.MM HH:mm:ss}}" Grid.Row="1" Margin="4,0" VerticalAlignment="Top" 
                                   HorizontalAlignment="Left" Foreground="{DynamicResource ColorText}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    
    <Style x:Key="HeaderPageText" TargetType="TextBlock">
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="FontSize" Value="28" />
        <Setter Property="FontFamily" Value="Segoe UI Light" />
        <Setter Property="Foreground" Value="{StaticResource ColorText}" />
        <Setter Property="Margin" Value="0,0,10,0" />
    </Style>


    <!-- контролы -->
    <Style x:Key="{x:Type Controls:FlameButtonInfo}" TargetType="{x:Type Controls:FlameButtonInfo}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:FlameButtonInfo}">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Button Content="{TemplateBinding Content}"/>
                        <TextBlock Text="Успешно" Foreground="{DynamicResource ColorGreenPastel}" FontSize="26" FontFamily="Segoe UI" 
                                   VerticalAlignment="Center" HorizontalAlignment="Center" Margin="14,0,0,0" FontWeight="Bold" 
                                   Visibility="{TemplateBinding LedVisibility}"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type Controls:FlameMenu}" TargetType="{x:Type Controls:FlameMenu}" BasedOn="{StaticResource {x:Type ListBox}}">
        <Setter Property="ItemContainerStyle" Value="{DynamicResource StyleFlameMenuItem}" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="MinWidth" Value="140" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{DynamicResource ColorText}" />
        <Setter Property="Visibility" Value="{Binding HasItems, RelativeSource={RelativeSource Self}, 
                        Converter={StaticResource BooleanToVisibilityConverter}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Controls:FlameMenu">
                    <DockPanel>
                        <Button x:Name="G0" DockPanel.Dock="Top" Content="{TemplateBinding Caption}" ClickMode="Press">
                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <TextBlock Text="{TemplateBinding Content}" FontFamily="Segoe UI Ligth" FontSize="28" Margin="8,4" Foreground="{StaticResource ColorInputText}" />
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                        <StackPanel x:Name="G1" Orientation="Horizontal" DockPanel.Dock="Top">
                            <Label TextBlock.Foreground="{TemplateBinding Foreground}" TextElement.FontSize="14" Content="{TemplateBinding SelectedItem}"
                                              ContentTemplate="{TemplateBinding ItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                              VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0,0,0" />
                            <Button x:Name="CleanButton" Click="CleanButton_Click" ClickMode="Press">
                                <Button.Template>
                                    <ControlTemplate>
                                        <Border HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" 
                                                Height="24" Margin="5,0" Style="{StaticResource SelectedBorder}" ToolTip="Убрать" >
                                            <Path Data="M1,1 L10,10 M1,10 L10,1" Stroke="{DynamicResource ColorBorder}" StrokeThickness="2" 
                                                  VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </Border>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                        </StackPanel>
                        <ScrollViewer Focusable="False">
                            <StackPanel x:Name="G2" IsItemsHost="True" DockPanel.Dock="Top" Visibility="Collapsed" />
                        </ScrollViewer>
                    </DockPanel>

                    <ControlTemplate.Triggers>
                        <Trigger Property="SelectedIndex" Value="-1">
                            <Setter Property="Visibility" TargetName="G1" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True" SourceName="G0">
                            <Setter Property="Visibility" TargetName="G2" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <EventSetter Event="Loaded" Handler="MenuCollectionChanged"/>
    </Style>
    <Style x:Key="StyleFlameMenuItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <ContentPresenter x:Name="ContentSite" TextElement.FontSize="16" TextBlock.FontSize="16" OverridesDefaultStyle="True"
                                      HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,5,10,0" />

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource ColorText}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="TextBlock.Foreground" Value="{StaticResource ColorActiveElement}" TargetName="ContentSite"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type Controls:FlameTblock}" TargetType="{x:Type Controls:FlameTblock}" BasedOn="{StaticResource {x:Type Label}}">
        <Setter Property="Margin" Value="0,4" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:FlameTblock}">
                    <DockPanel>
                        <Label Content="{TemplateBinding Header}" FontSize="20" Foreground="{DynamicResource ColorTextBackground}" 
                               FontFamily="Segoe UI Light" DockPanel.Dock="Left"/>

                        <Label Content="{TemplateBinding Content}" Margin="10,0,0,0" FontSize="20" ContentStringFormat="{TemplateBinding ContentStringFormat}"
                               Foreground="{DynamicResource ColorText}" DockPanel.Dock="Left"/>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Content" Value="">
                <Setter Property="Visibility" Value="Collapsed" />
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="{x:Type Controls:FlameTbox}" TargetType="{x:Type Controls:FlameTbox}" BasedOn="{StaticResource {x:Type TextBox}}">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:FlameTbox}">
                    <DockPanel HorizontalAlignment="Stretch">
                        <TextBlock Text="{TemplateBinding Header}" HorizontalAlignment="Left" VerticalAlignment="Center"
                                   DockPanel.Dock="Left" FontSize="18" FontFamily="Segoe UI Light" Foreground="{DynamicResource ColorTextBackground}" />

                        <Border BorderBrush="{TemplateBinding BorderBrush}" DockPanel.Dock="Left" Background="{TemplateBinding Background}" 
                                BorderThickness="1" Margin="12,0,0,0">

                            <ScrollViewer x:Name="PART_ContentHost" Margin="2" MinWidth="200" VerticalAlignment="Center" 
                                          HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" />
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ColorActiveElement}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <!---->


    <!-- избавиться -->
    <Style x:Key="FunctionPanel" TargetType="{x:Type ListBox}">
        <Setter Property="Background" Value="Gray" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
        <Setter Property="SelectionMode" Value="Single" />
        <Setter Property="Padding" Value="10,4" />
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="ItemContainerStyle" Value="{DynamicResource FunctionPanelItem}" />
        <Setter Property="IsEnabled" Value="{Binding Path=HasItems, UpdateSourceTrigger=PropertyChanged, IsAsync=True, Mode=OneWay, RelativeSource={RelativeSource Self}}" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="FunctionPanelItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Margin" Value="10,0" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
    </Style>
    <!---->

</ResourceDictionary>